home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / reportplus / source / f2.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-27  |  41.1 KB  |  1,257 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <clib/exec_protos.h>
  4. #include <intuition/intuition.h>
  5. #include <clib/intuition_protos.h>
  6. #include <libraries/gadtools.h>
  7. #include <clib/gadtools_protos.h>
  8. #include <graphics/gfx.h>
  9. #include <clib/graphics_protos.h>
  10.  
  11. #include <clib/alib_protos.h>
  12. #include <ctype.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include "rp.h"
  16.  
  17. #define ALL_REACTION_CLASSES
  18. #define ALL_REACTION_MACROS
  19. #include <reaction/reaction.h>
  20. #include <gadgets/texteditor.h>
  21. #include <clib/texteditor_protos.h>
  22. #include <pragmas/texteditor_pragmas.h>
  23.  
  24. #define MAINTYPES   15
  25. #define CATEGORIES 343
  26. struct
  27. {   ULONG start, end;
  28. } offsets[MAINTYPES + 1] =
  29. {   16,  26, // biz
  30.     27,  47, // comm
  31.     48,  73, // demo
  32.     74,  90, // dev
  33.     91,  97, // disk
  34.     98, 105, // docs
  35.    106, 120, // game
  36.    121, 132, // gfx
  37.    133, 135, // hard
  38.    136, 140, // info
  39.    141, 150, // misc
  40.    151, 263, // mods
  41.    264, 267, // mus
  42.    268, 309, // pix
  43.    310, 320, // text
  44.    321, 343  // util
  45. };
  46.  
  47. AGLOBAL struct AminetStruct aminet;
  48.  
  49. // from rp.c
  50. IMPORT ABOOL                fillwindows;
  51. IMPORT SBYTE                page;
  52. IMPORT TEXT                 IOBuffer[LONGESTFIELD + 1],
  53.                             aslresult[PATHNAMEFIELD + 1],
  54.                             string[LONGESTFIELD + 1];
  55. IMPORT ULONG                offset;
  56. IMPORT struct SharedStruct  shared;
  57. IMPORT struct Window*       MainWindowPtr;
  58. IMPORT struct Library*      TextEditorBase;
  59. IMPORT Object*              WinObject[FUNCTIONS + 1]; // note that WindowObject is a reserved macro
  60. IMPORT struct Menu*         MenuPtr;
  61. IMPORT struct Screen*       ScreenPtr;
  62. IMPORT struct TextAttr      Topaz8;
  63.  
  64. MODULE void updateaminetgadgets(void);
  65. MODULE void readaminetgadgets(void);
  66. MODULE void updatesubtype(void);
  67.  
  68. MODULE ABOOL          MainTypeNodes     = FALSE,
  69.                       SubTypeNodes      = FALSE;
  70. MODULE struct List    MainTypeList,
  71.                       SubTypeList,
  72.                       EmptySubTypeList;
  73.  
  74. MODULE struct Gadget *aminet_gadgets[GIDS_2 + 1];
  75.  
  76. MODULE struct
  77. {   STRPTR name;
  78.     STRPTR desc;
  79. } category[CATEGORIES + 1] =
  80. { // all (0)
  81. "biz",   "Business software",
  82. "comm",  "Communications",
  83. "demo",  "Gfx and sound demos",
  84. "dev",   "Development software",
  85. "disk",  "Disk/Harddisk tools",
  86. "docs",  "Text documents",
  87. "game",  "Games",
  88. "gfx",   "Graphics",
  89. "hard",  "Hardware",
  90. "info",  "General FTP information",
  91. "misc",  "Miscellaneous",
  92. "mods",  "Music modules",
  93. "mus",   "Musical software",
  94. "pix",   "Pictures",
  95. "text",  "Text related",
  96. "util",  "Utilities",
  97. // biz (16)
  98. "cloan", "Cloanto software & support",
  99. "dbase", "Data base software",
  100. "demo",  "Demo versions of commercial software",
  101. "dkg",   "DarkAge software & support",
  102. "dopus", "Directory Opus files",
  103. "haage", "Haage & Partner software & support",
  104. "misc",  "Misc business type soft",
  105. "patch", "Commercial software patches",
  106. "p5",    "phase5 software & support",
  107. "swood", "Softwood products",
  108. "titan", "Titan Computer software",
  109. // comm (27)
  110. "ambos", "AmBoS (BBS) related",
  111. "amiex", "Ami-Express BBS related",
  112. "bbs",   "BBS programs",
  113. "cnet",  "CNET BBS related",
  114. "dlg",   "DLG BBS related",
  115. "fido",  "FIDO software",
  116. "irc",   "Internet Relay Chat software",
  117. "mail",  "Mailing soft",
  118. "maxs",  "MaxsBBS related",
  119. "mebbs", "MEBBSNet BBS related",
  120. "misc",  "Misc communications",
  121. "mmgr",  "MailManager related",
  122. "net",   "Networking",
  123. "news",  "Newsreaders",
  124. "tcp",   "AmiTCP networking",
  125. "term",  "Terminal programs",
  126. "thor",  "Thor mail/news system",
  127. "ums",   "Universal Message System",
  128. "uucp",  "UUCP software",
  129. "www",   "World Wide Web software",
  130. "xeno",  "Xenolink BBS related",
  131. // demo (48)
  132. "40k",   "40K intros",
  133. "aga",   "Demos requiring AGA chipset",
  134. "bse",   "Belgian Scene Event files",
  135. "disk",  "Demos on diskettes",
  136. "ecs",   "Demos for the ECS chip set",
  137. "euro",  "Euro demos in file form",
  138. "file",  "Single file demos",
  139. "funet", "From the Funet collection",
  140. "intro", "Intros",
  141. "mag",   "Demo coder magazines",
  142. "mega",  "Euro demos requiring floppies",
  143. "slide", "Image oriented demos",
  144. "sound", "Sound oriented demos",
  145. "sp96",  "Saturne Party 96 demos",
  146. "ta95",  "Demos from The Assembly 95",
  147. "ta96",  "Demos from The Assembly 96",
  148. "ta97",  "Demos from The Assembly 97",
  149. "tg93",  "The Gathering 1993 demos",
  150. "tg95",  "The Gathering 1995 demos",
  151. "tg96",  "The Gathering 1996 demos",
  152. "tg97",  "The Gathering 1997 demos",
  153. "tp92",  "Demos from The Party 92",
  154. "tp94",  "Demos from The Party 94",
  155. "tp95",  "Demos from The Party 95",
  156. "tp96",  "Demos from The Party 96",
  157. "track", "Trackmos",
  158. // dev (74)
  159. "amos",  "AMOS BASIC compiler",
  160. "asm",   "Assembly language related",
  161. "basic", "BASIC language related",
  162. "c",     "C language related",
  163. "cross", "Cross development",
  164. "debug", "Debugging software",
  165. "e",     "E language related",
  166. "gcc",   "GNU C compiler",
  167. "gg",    "Geek Gadgets GNU software",
  168. "gui",   "GUI builders",
  169. "lang",  "Various languages",
  170. "m2",    "Modula-2 related",
  171. "misc",  "Misc development software",
  172. "moni",  "Monitors/disassemblers",
  173. "mui",   "MagicUserInterface related",
  174. "obero", "Oberon related software",
  175. "src",   "Tutorial sources",
  176. // disk (92)
  177. "bakup", "Backup software",
  178. "cache", "Disk caching",
  179. "cdrom", "CD-ROM related software",
  180. "misc",  "Various disk related tools",
  181. "moni",  "Disk monitors",
  182. "optim", "Disk optimizers",
  183. "salv",  "Disk recovery software",
  184. // docs (99)
  185. "anno",  "Announcement documents",
  186. "etext", "Project Gutenberg books",
  187. "help",  "Help on various issues",
  188. "hyper", "Hypertext documents",
  189. "lists", "Lists and tables",
  190. "mags",  "Magazines",
  191. "misc",  "Various documents",
  192. "rview", "Amiga product reviews",
  193. // game (107)
  194. "2play", "2 and more player games",
  195. "actio", "Action games",
  196. "board", "Board games",
  197. "data",  "Data files for games",
  198. "demo",  "Demos of commercial games",
  199. "gag",   "Gag programs",
  200. "hint",  "Game hint documents",
  201. "jump",  "Jump-n-run games",
  202. "misc",  "Miscellaneous games",
  203. "patch", "Patches for games",
  204. "role",  "Role, adventure games",
  205. "shoot", "Shoot-em-up games",
  206. "text",  "Text based adventures",
  207. "think", "Mind games",
  208. "wb",    "Workbench games",
  209. // gfx  (122)
  210. "3d",    "3D graphics software",
  211. "3dobj", "3D objects",
  212. "aga",   "AGA chip set software",
  213. "board", "Custom gfx board software",
  214. "conv",  "Gfx conversion tools",
  215. "edit",  "Paint programs",
  216. "fract", "Fractals and Mandelbrots",
  217. "ifx",   "ImageFX related files",
  218. "misc",  "Misc graphics software",
  219. "pbm",   "Pbm+ gfx conversion",
  220. "show",  "Image/anim displayers",
  221. "x11",   "Amiga X-Windows",
  222. // hard (134)
  223. "drivr", "Drivers for hardware",
  224. "hack",  "Selfmade hardware",
  225. "misc",  "Misc hardware related files",
  226. // info (137)
  227. "adt",   "Machine readable filelists",
  228. "index", "Various Aminet index files",
  229. "sites", "Info on other FTP sites",
  230. "start", "Beginner information",
  231. "stats", "Statistics about this site",
  232. // misc (142)
  233. "amag",  "German Amiga Mag PD",
  234. "antiq", "Nostalgic stuff",
  235. "edu",   "Educational software",
  236. "emu",   "Emulations",
  237. "imdb",  "Internet Movie Database",
  238. "kids",  "Children's software",
  239. "math",  "Mathematics",
  240. "misc",  "Uncategorizable",
  241. "sci",   "Scientific software",
  242. "unix",  "Amiga related UNIX software",
  243. // mods (152)
  244. "32bit", "MP3s by 32bit choonz",
  245. "4mat",  "Mods by 4mat",
  246. "8voic", "8-voiced songs",
  247. "airon", "Mods by Airon",
  248. "alpma", "Mods by Johan Alpmar",
  249. "atmos", "Atmospheric music",
  250. "aweso", "Mods by Dr Awesome",
  251. "bhead", "Mods by Basehead",
  252. "bladr", "Mods by Black Dragon",
  253. "blk",   "Mods by Black Shadow",
  254. "blkha", "Mods by Blakkhar",
  255. "boing", "Boing collection",
  256. "boray", "Mods by Boray",
  257. "casef", "Mods by Case and Filippetto",
  258. "cato",  "Mods by Don Cato",
  259. "cels",  "Mods by Celsius",
  260. "chart", "Module hits",
  261. "chip",  "Mods without samples",
  262. "chrom", "Mods by Chromag",
  263. "chryl", "Mods by Chrylian",
  264. "clawz", "Mods by Clawz",
  265. "cloud", "Mods by Cloud",
  266. "crash", "Mods by Crash Noise Division",
  267. "crn",   "Mods by Corrosion",
  268. "ctp",   "Mods by Counterpoint",
  269. "cutc",  "Mods by Cutcreator",
  270. "darde", "Mods by Fredius Darde",
  271. "dean",  "Mods by Dean",
  272. "delor", "Mods by Delorean",
  273. "demo",  "Demo style music",
  274. "dizzy", "Mods by Dizzy",
  275. "dlusn", "Mods by D.Lusion",
  276. "doh",   "Mods by Doh",
  277. "dremr", "Mods by Dreamer",
  278. "dsx",   "Mods by DSX",
  279. "elbie", "Mods by Elbie",
  280. "emax",  "Mods by Emax",
  281. "ephnx", "Mods by Euphonix",
  282. "essen", "Mods by Essential Sound", // new for 5.63
  283. "evrim", "Mods by Evrimsson",
  284. "exprt", "Mods by Expert",
  285. "facet", "Mods by Facet",
  286. "fby",   "Mods by Fabio Barzagli",
  287. "fermx", "Mods by Fermix",
  288. "fox2",  "Mods by TheFoxII",
  289. "funet", "Funet collection",
  290. "funk",  "Funky/jazzy mods",
  291. "hardc", "Hardcore techno",
  292. "hje",   "Mods by H.J. Ehrentraud",
  293. "huezo", "Mods by Huezo",
  294. "house", "House modules",
  295. "hw",    "Mods by Hillware",
  296. "inst",  "Instruments for modules",
  297. "instr", "Instrumental music",
  298. "jogei", "Mods by Jogeir Liljedahl",
  299. "jorma", "Mods by Da Jormas (techno)",
  300. "jungl", "Jungle/Breakbeat mods",
  301. "k4k",   "Mods by k4k",
  302. "kaa",   "Mods by Redd Kaa",
  303. "lead",  "Mods by Lead",
  304. "mark",  "Mods by Mark Salud",
  305. "maxym", "Mods by Maxym",
  306. "med",   "MED modules",
  307. "melod", "Melodic modules",
  308. "melom", "Mods by MeloManiac",
  309. "midi",  "Music in MIDI format",
  310. "misc",  "Miscellaneous songs",
  311. "mnc",   "Mods by Meanace",
  312. "mpg",   "Music in MPEG audio format",
  313. "mryo",  "Mods by Mr. Yo",
  314. "mvp",   "Mods by MoPlayaz",
  315. "ncase", "Mods by Nutcase",
  316. "neuro", "Neurodancer's modules",
  317. "nork",  "Mods by Nork",
  318. "ooze",  "Mods by Ooze",
  319. "otis",  "Mods by Otis",
  320. "panik", "Mods by Panik",
  321. "pdy",   "Mods by Prodigy",
  322. "pete",  "Mods by Pirate Pete",
  323. "piano", "Piano mods",
  324. "pop",   "Pop music",
  325. "pro",   "Protracker songs",
  326. "przk",  "Mods by Parsec",
  327. "punn",  "Mods by Punnik",
  328. "purg",  "Mods by Purgatory",
  329. "racoo", "Mods by Racoon",
  330. "rated", "Misc rated modules",
  331. "rebel", "Mods by Rebel Riffs",
  332. "rock",  "Rock'n'Roll",
  333. "roz",   "Mods by Roz",
  334. "s3m",   "Multichannel s3m mods",
  335. "sbc",   "Modules by Substance",
  336. "sets",  "Module collections",
  337. "sidew", "Mods by Sidewinder",
  338. "slc",   "Mods by Slice",
  339. "slow",  "Slow, melodic modules",
  340. "smg",   "Modes by esemgy",
  341. "smpl",  "Sound samples",
  342. "sonor", "Mods by Sonority",
  343. "spark", "Mods by P.D. Spark",
  344. "stame", "Mods by Stamen",
  345. "synth", "Synthesizer modules",
  346. "techn", "Techno music",
  347. "toady", "Mods by Olivier Gonneau",
  348. "tranc", "Trance techno mods",
  349. "tp96",  "Mods from The Party 1996",
  350. "uns",   "Mods by UnIsOn",
  351. "vdo",   "Mods by Voodoo Audio Group", // new for 5.63
  352. "voice", "Music with voices",
  353. "voy",   "Mods by Voyager",
  354. "wmr",   "Mods reviewed by WMR",
  355. "xceed", "Mods by X-Ceed (ex Snoopy)",
  356. "xm",    "Multichannel xm mods",
  357. // mus (261)
  358. "edit",  "Composing software",
  359. "midi",  "MIDI software",
  360. "misc",  "Miscellaneous",
  361. "play",  "Sound players",
  362. // pix (265)
  363. "3dani", "3D animations",
  364. "addic", "Pictures by 3DAddict",
  365. "anim",  "Animations",
  366. "art",   "Hand drawn imagery",
  367. "astro", "Astronomy pictures",
  368. "back",  "Workbench backdrop pictures",
  369. "bill",  "Bill Graham traces",
  370. "boot",  "Boot pictures",
  371. "clip",  "Clip art",
  372. "eps",   "Structured EPS images",
  373. "eric",  "Eric Schwartz anims",
  374. "fauna", "Animals",
  375. "fract", "Fractals",
  376. "gicon", "GlowIcons",
  377. "glenn", "Traces by Glenn J. Schworak",
  378. "guard", "Guardians traces",
  379. "heiko", "Traces by Heiko Popp",
  380. "henz",  "Traces by Patrick Henz",
  381. "icon",  "Workbench icons",
  382. "illu",  "Illustrations",
  383. "imagi", "Imagine traces",
  384. "irc",   "The people on IRC",
  385. "jake",  "The Ragtime Gallery",
  386. "jason", "Jason Brown illustration",
  387. "map",   "Images of maps",
  388. "mark",  "Traces by Markus Kuhnen",
  389. "misc",  "Miscellaneous images",
  390. "mpg",   "MPEG animations",
  391. "mwb",   "MagicWB icons",
  392. "nevil", "Pics by Neville Rolle",
  393. "nicon", "NewIcons",
  394. "park",  "Maps of US national parks",
  395. "real3", "Real3D traces",
  396. "sport", "Sports pictures",
  397. "textu", "Textures",
  398. "tp96",  "Pics from The Party 1996",
  399. "trace", "Raytraced pictures",
  400. "unrl",  "Animations by Unreal",
  401. "vehic", "Vehicle images",
  402. "views", "Scenery, countries",
  403. "wb",    "Example WB screens",
  404. "wfm",   "Artwork of William F. Maddock",
  405. // text (305)
  406. "bfont", "Bitmap font collection",
  407. "dtp",   "Desk top publishing",
  408. "edit",  "Editors",
  409. "font",  "Fonts of all formats and related too", // ..."ls"
  410. "hyper", "Hypertext tools",
  411. "ifont", "Intellifont collection",
  412. "misc",  "Misc text software",
  413. "pfont", "Postscript font collection",
  414. "print", "Printing tools",
  415. "show",  "Text displayers",
  416. "tex",   "TeX formatting package",
  417. // util (316)
  418. "app",   "AppIcons, AppWindows",
  419. "arc",   "Archivers",
  420. "batch", "Script software",
  421. "blank", "Screen blankers",
  422. "boot",  "Startup sequence software",
  423. "cdity", "Commodity type software",
  424. "cli",   "Command line interface",
  425. "conv",  "File conversion",
  426. "crypt", "Encryption tools",
  427. "dir",   "Directory utilities",
  428. "dtype", "Datatypes for OS 3.x",
  429. "gnu",   "GNU utilities",
  430. "libs",  "Libraries",
  431. "misc",  "Miscellaneous",
  432. "moni",  "System monitors",
  433. "mouse", "Mouse accelerators",
  434. "pack",  "Packers",
  435. "rexx",  "ARexx tools",
  436. "shell", "Shells",
  437. "sys",   "Common file replacements",
  438. "time",  "Clocks and timing",
  439. "virus", "Virus checkers",
  440. "wb",    "Workbench utilities"
  441. };
  442.  
  443. AGLOBAL void aminet1(void)
  444. {   struct Hook Hook2Struct;
  445.  
  446.     if ((!(aminet.uploader[0])) && readin("S:Report.sender"))
  447.     {   /* # Refer: <last>,<first> (<company> ,phone <phone>)<LF>
  448.            # Path: <email><LF>
  449.            # ReferID: <developer><LF> */
  450.  
  451.         offset = 0;
  452.         parse("# Refer: ");
  453.         parse(",");
  454.         parse(" (");
  455.         parse(" ,phone ");
  456.         parse(")\n# Path: ");
  457.         parse("\n# ReferID: ");
  458.         strcpy(aminet.uploader, string);
  459.     }
  460.  
  461.     InitHook(&Hook2Struct, Hook2Func, NULL);
  462.  
  463.     /* Create the window object. */
  464.     lockscreen();
  465.  
  466. if (!(WinObject[2] =
  467. NewObject
  468. (   WINDOW_GetClass(),                    NULL,
  469.     WA_PubScreen,                         ScreenPtr,
  470.     WA_ScreenTitle,                       "Report+",
  471.     WA_Title,                             "Report+: Aminet Readme Editor",
  472.     WA_Activate,                          TRUE,
  473.     WA_DepthGadget,                       TRUE,
  474.     WA_DragBar,                           TRUE,
  475.     WA_CloseGadget,                       TRUE,
  476.     WA_SizeGadget,                        TRUE,
  477.     WA_IDCMP,                             IDCMP_RAWKEY,
  478.     WINDOW_IDCMPHook,                     &Hook2Struct,
  479.     WINDOW_IDCMPHookBits,                 IDCMP_RAWKEY,
  480.     WINDOW_MenuStrip,                     MenuPtr,
  481.     WINDOW_Position,                      WPOS_CENTERSCREEN,
  482.     WINDOW_ParentGroup,                   aminet_gadgets[GID_2_LY1] =
  483.     NewObject
  484.     (   LAYOUT_GetClass(),                NULL,
  485.         LAYOUT_Orientation,               LAYOUT_ORIENT_VERT,
  486.         LAYOUT_SpaceOuter,                TRUE,
  487.         LAYOUT_DeferLayout,               TRUE,
  488.         LAYOUT_AddChild,
  489.         NewObject
  490.         (   LAYOUT_GetClass(),            NULL,
  491.             LAYOUT_Orientation,           LAYOUT_ORIENT_HORIZ,
  492.             LAYOUT_DeferLayout,           TRUE,
  493.             LAYOUT_BevelStyle,            BVS_NONE,
  494.             LAYOUT_AddChild,
  495.             NewObject
  496.             (   LAYOUT_GetClass(),        NULL,
  497.                 LAYOUT_Orientation,       LAYOUT_ORIENT_VERT,
  498.                 LAYOUT_VertAlignment,     LALIGN_CENTER,
  499.                 LAYOUT_BevelStyle,        BVS_NONE,
  500.                 LAYOUT_AddChild,
  501.                 NewObject
  502.                 (   LAYOUT_GetClass(),    NULL,
  503.                     LAYOUT_Orientation,   LAYOUT_ORIENT_HORIZ,
  504.                     LAYOUT_HorizAlignment,LALIGN_RIGHT,
  505.                     LAYOUT_BevelStyle,    BVS_NONE,
  506.                     LAYOUT_AddImage,
  507.                     NewObject
  508.                     (   LABEL_GetClass(),     NULL,
  509.                         LABEL_Text,           "_Short:",
  510.                         LABEL_Justification,  LJ_RIGHT,
  511.                     TAG_END),
  512.                 TAG_END),
  513.                 LAYOUT_AddChild,
  514.                 NewObject
  515.                 (   LAYOUT_GetClass(),        NULL,
  516.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  517.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  518.                     LAYOUT_BevelStyle,        BVS_NONE,
  519.                     LAYOUT_AddImage,
  520.                     NewObject
  521.                     (   LABEL_GetClass(),     NULL,
  522.                         LABEL_Text,           "_Uploader:",
  523.                         LABEL_Justification,  LJ_RIGHT,
  524.                     TAG_END),
  525.                 TAG_END),
  526.                 LAYOUT_AddChild,
  527.                 NewObject
  528.                 (   LAYOUT_GetClass(),        NULL,
  529.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  530.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  531.                     LAYOUT_BevelStyle,        BVS_NONE,
  532.                     LAYOUT_AddImage,
  533.                     NewObject
  534.                     (   LABEL_GetClass(),     NULL,
  535.                         LABEL_Text,           "_Author:",
  536.                         LABEL_Justification,  LJ_RIGHT,
  537.                     TAG_END),
  538.                 TAG_END),
  539.                 LAYOUT_AddChild,
  540.                 NewObject
  541.                 (   LAYOUT_GetClass(),        NULL,
  542.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  543.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  544.                     LAYOUT_BevelStyle,        BVS_NONE,
  545.                     LAYOUT_AddImage,
  546.                     NewObject
  547.                     (   LABEL_GetClass(),     NULL,
  548.                         LABEL_Text,           "_Replaces:",
  549.                         LABEL_Justification,  LJ_RIGHT,
  550.                     TAG_END),
  551.                 TAG_END),
  552.                 LAYOUT_AddChild,
  553.                 NewObject
  554.                 (   LAYOUT_GetClass(),        NULL,
  555.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  556.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  557.                     LAYOUT_BevelStyle,        BVS_NONE,
  558.                     LAYOUT_AddImage,
  559.                     NewObject
  560.                     (   LABEL_GetClass(),     NULL,
  561.                         LABEL_Text,           "R_equires:",
  562.                         LABEL_Justification,  LJ_RIGHT,
  563.                     TAG_END),
  564.                 TAG_END),
  565.                 LAYOUT_AddChild,
  566.                 NewObject
  567.                 (   LAYOUT_GetClass(),        NULL,
  568.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  569.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  570.                     LAYOUT_BevelStyle,        BVS_NONE,
  571.                     LAYOUT_AddImage,
  572.                     NewObject
  573.                     (   LABEL_GetClass(),     NULL,
  574.                         LABEL_Text,           "_Version:",
  575.                         LABEL_Justification,  LJ_RIGHT,
  576.                     TAG_END),
  577.                 TAG_END),
  578.                 LAYOUT_AddChild,
  579.                 NewObject
  580.                 (   LAYOUT_GetClass(),        NULL,
  581.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  582.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  583.                     LAYOUT_BevelStyle,        BVS_NONE,
  584.                     LAYOUT_AddImage,
  585.                     NewObject
  586.                     (   LABEL_GetClass(),     NULL,
  587.                         LABEL_Text,           "_Distribution:",
  588.                         LABEL_Justification,  LJ_RIGHT,
  589.                     TAG_END),
  590.                 TAG_END),
  591.             TAG_END),
  592.             CHILD_WeightedWidth,      0,
  593.             LAYOUT_AddChild,
  594.             NewObject
  595.             (   LAYOUT_GetClass(),    NULL,
  596.                 LAYOUT_Orientation,   LAYOUT_ORIENT_VERT,
  597.                 LAYOUT_VertAlignment, LALIGN_CENTER,
  598.                 LAYOUT_HorizAlignment,LALIGN_CENTER,
  599.                 LAYOUT_BevelStyle,    BVS_NONE,
  600.                 LAYOUT_AddChild,      aminet_gadgets[GID_2_ST1] =
  601.                 NewObject
  602.                 (   STRING_GetClass(),    NULL,
  603.                     GA_ID,                GID_2_ST1,
  604.                     GA_TabCycle,          TRUE,
  605.                     STRINGA_TextVal,      aminet.amishort,
  606.                     STRINGA_MinVisible,   20,
  607.                     STRINGA_MaxChars,     40,
  608.                 TAG_END),
  609.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST2] =
  610.                 NewObject
  611.                 (   STRING_GetClass(),    NULL,
  612.                     GA_ID,                GID_2_ST2,
  613.                     GA_TabCycle,          TRUE,
  614.                     STRINGA_TextVal,      aminet.uploader,
  615.                     STRINGA_MinVisible,   20,
  616.                     STRINGA_MaxChars,     40,
  617.                 TAG_END),
  618.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST3] =
  619.                 NewObject
  620.                 (   STRING_GetClass(),    NULL,
  621.                     GA_ID,                GID_2_ST3,
  622.                     GA_TabCycle,          TRUE,
  623.                     STRINGA_TextVal,      aminet.author,
  624.                     STRINGA_MinVisible,   20,
  625.                     STRINGA_MaxChars,     40,
  626.                 TAG_END),
  627.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST4] =
  628.                 NewObject
  629.                 (   STRING_GetClass(),    NULL,
  630.                     GA_ID,                GID_2_ST4,
  631.                     GA_TabCycle,          TRUE,
  632.                     STRINGA_TextVal,      aminet.version,
  633.                     STRINGA_MinVisible,   20,
  634.                     STRINGA_MaxChars,     40,
  635.                 TAG_END),
  636.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST5] =
  637.                 NewObject
  638.                 (   STRING_GetClass(),    NULL,
  639.                     GA_ID,                GID_2_ST5,
  640.                     GA_TabCycle,          TRUE,
  641.                     STRINGA_TextVal,      aminet.replaces,
  642.                     STRINGA_MinVisible,   20,
  643.                     STRINGA_MaxChars,     40,
  644.                 TAG_END),
  645.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST6] =
  646.                 NewObject
  647.                 (   STRING_GetClass(),    NULL,
  648.                     GA_ID,                GID_2_ST6,
  649.                     GA_TabCycle,          TRUE,
  650.                     STRINGA_TextVal,      aminet.requires,
  651.                     STRINGA_MinVisible,   20,
  652.                     STRINGA_MaxChars,     40,
  653.                 TAG_END),
  654.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST7] =
  655.                 NewObject
  656.                 (   STRING_GetClass(),    NULL,
  657.                     GA_ID,                GID_2_ST7,
  658.                     GA_TabCycle,          TRUE,
  659.                     STRINGA_TextVal,      aminet.distribution,
  660.                     STRINGA_MinVisible,   20,
  661.                     STRINGA_MaxChars,     40,
  662.                 TAG_END),
  663.             TAG_END),
  664.         TAG_END),
  665.         CHILD_WeightedHeight,         0,
  666.         LAYOUT_AddChild,
  667.         NewObject
  668.         (   LAYOUT_GetClass(),        NULL,
  669.             LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  670.             LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  671.             LAYOUT_BevelStyle,        BVS_NONE,
  672.             LAYOUT_AddImage,
  673.             NewObject
  674.             (   LABEL_GetClass(),     NULL,
  675.                 LABEL_Text,           "_Long description:",
  676.                 LABEL_Justification,  LJ_CENTER,
  677.             TAG_END),
  678.         TAG_END),
  679.         CHILD_WeightedHeight,         0,
  680.         LAYOUT_AddChild,              aminet_gadgets[GID_2_TE1] =
  681.         NewObject
  682.         (   TEXTEDITOR_GetClass(),    NULL,
  683.             GA_ID,                    GID_2_TE1,
  684.             GA_TabCycle,              TRUE,
  685.             GA_RelVerify,             TRUE,
  686.             GA_TEXTEDITOR_ExportWrap, 75,
  687.         TAG_END),
  688.         CHILD_WeightedHeight,         50,
  689.         CHILD_MinHeight,              92,
  690.         LAYOUT_AddChild,
  691.         NewObject
  692.         (   LAYOUT_GetClass(),        NULL,
  693.             LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  694.             LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  695.             LAYOUT_BevelStyle,        BVS_NONE,
  696.             LAYOUT_AddImage,
  697.             NewObject
  698.             (   LABEL_GetClass(),     NULL,
  699.                 LABEL_Text,           "Directory:",
  700.                 LABEL_Justification,  LJ_CENTER,
  701.             TAG_END),
  702.             CHILD_WeightedWidth,      50,
  703.             LAYOUT_AddImage,
  704.             NewObject
  705.             (   LABEL_GetClass(),     NULL,
  706.                 LABEL_Text,           "Subdirectory:",
  707.                 LABEL_Justification,  LJ_CENTER,
  708.             TAG_END),
  709.             CHILD_WeightedWidth,      50,
  710.         TAG_END),
  711.         CHILD_WeightedHeight,         0,
  712.         LAYOUT_AddChild,
  713.         NewObject
  714.         (   LAYOUT_GetClass(),        NULL,
  715.             LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  716.             LAYOUT_HorizAlignment,    LALIGN_CENTER,
  717.             LAYOUT_BevelStyle,        BVS_NONE,
  718.             LAYOUT_AddChild,          aminet_gadgets[GID_2_LB1] =
  719.             NewObject
  720.             (   LISTBROWSER_GetClass(),NULL,
  721.                 GA_ID,                 GID_2_LB1,
  722.                 GA_RelVerify,          TRUE,
  723.                 GA_TextAttr,           &Topaz8,
  724.                 LISTBROWSER_Labels,    (ULONG) &MainTypeList,
  725.                 LISTBROWSER_MinVisible,6,
  726.             TAG_END),
  727.             LAYOUT_AddChild,           aminet_gadgets[GID_2_LB2] =
  728.             NewObject
  729.             (   LISTBROWSER_GetClass(),NULL,
  730.                 GA_ID,                 GID_2_LB2,
  731.                 GA_RelVerify,          TRUE,
  732.                 GA_TextAttr,           &Topaz8,
  733.                 LISTBROWSER_Labels,    (ULONG) &EmptySubTypeList,
  734.                 LISTBROWSER_MinVisible,6,
  735.             TAG_END),
  736.         TAG_END),
  737.         CHILD_WeightedHeight,          50,
  738.     TAG_END),
  739. TAG_END)))
  740. {   rq("Can't create ReAction gadgets!");
  741. }
  742. unlockscreen();
  743. openwindow();
  744.  
  745.     SetGadgetAttrs
  746.     (   aminet_gadgets[GID_2_TE1],    MainWindowPtr, NULL,
  747.         GA_TEXTEDITOR_Contents, aminet.textfield
  748.     ); // long description
  749.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_NEW,    NOSUB));
  750.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_OPEN,   NOSUB));
  751.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVE,   NOSUB));
  752.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVEAS, NOSUB));
  753.  
  754.     updatesubtype();
  755.     ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST1]);
  756.     loop();
  757.     readaminetgadgets();
  758.     closewindow();
  759.     // now that the window is closed we can free lists
  760.     aminet_exit();
  761. }
  762.  
  763. AGLOBAL void saveaminet(ABOOL saveas)
  764. {   /*  Short:        <short>
  765.         Uploader:     <uploader>
  766.         Author:       <author>
  767.         Type:         <type>
  768.         Replaces:     <replaces>
  769.         Requires:     <requires>
  770.         Version:      <version>
  771.         Distribution: <distribution>
  772.         
  773.         <long description> */
  774.  
  775.     readaminetgadgets();
  776.  
  777.     strcpy(IOBuffer, "Short:        ");
  778.     strcat(IOBuffer, aminet.amishort);
  779.     strcat(IOBuffer, "\n");
  780.     if (aminet.uploader[0])
  781.     {    strcat(IOBuffer, "Uploader:     ");
  782.             strcat(IOBuffer, aminet.uploader);
  783.         strcat(IOBuffer, "\n");
  784.     }
  785.     if (aminet.author[0])
  786.     {   strcat(IOBuffer, "Author:       ");
  787.         strcat(IOBuffer, aminet.author);
  788.         strcat(IOBuffer, "\n");
  789.     }
  790.     // it's compulsory to select a type
  791.     strcat(IOBuffer, "Type:         ");
  792.     strcat(IOBuffer, aminet.type);
  793.     strcat(IOBuffer, "\n");
  794.     if (aminet.replaces[0])
  795.     {   strcat(IOBuffer, "Replaces:     ");
  796.         strcat(IOBuffer, aminet.replaces);
  797.         strcat(IOBuffer, "\n");
  798.     }
  799.     if (aminet.requires[0])
  800.     {   strcat(IOBuffer, "Requires:     ");
  801.         strcat(IOBuffer, aminet.requires);
  802.         strcat(IOBuffer, "\n");
  803.     }
  804.     if (aminet.version[0])
  805.     {   strcat(IOBuffer, "Version:      ");
  806.         strcat(IOBuffer, aminet.version);
  807.         strcat(IOBuffer, "\n");
  808.     }
  809.     if (aminet.distribution[0])
  810.     {   strcat(IOBuffer, "Distribution: ");
  811.         strcat(IOBuffer, aminet.distribution);
  812.         strcat(IOBuffer, "\n");
  813.     }
  814.     strcat(IOBuffer, "\n");
  815.     strcat(IOBuffer, aminet.textfield);
  816.  
  817.     if (!aminet.output[0] || saveas) // if we need a filename
  818.     {   if (saveasl("Save Aminet Readme", "#?.readme"))
  819.         {   strcpy(aminet.output, aslresult);
  820.             writeout(aminet.output);
  821.     }   }
  822.     writeout(aminet.output);
  823. }
  824.  
  825. AGLOBAL void aminet_exit(void)
  826. {   if (SubTypeNodes)
  827.     {   clearreactionlist(&SubTypeList);
  828.         SubTypeNodes = FALSE;
  829. }   }
  830.  
  831. AGLOBAL void aminet_loop(ULONG gid)
  832. {   ULONG code;
  833.  
  834.     switch(gid)
  835.     {
  836.     case GID_2_LB1:
  837.         /* code is the position within the list, starting from 0. */
  838.         if (!(GetAttr
  839.         (   LISTBROWSER_Selected, aminet_gadgets[GID_2_LB1], (ULONG *) &code
  840.         )))
  841.         {   rq("Unsupported inquiry!"); // should never happen
  842.         }
  843.         aminet.maintype = code;
  844.         aminet.subtype  = 0;
  845.         updatesubtype();
  846.     break;
  847.     case GID_2_LB2:
  848.         /* code is the position within the list, starting from 0. */
  849.         if (!(GetAttr
  850.         (   LISTBROWSER_Selected, aminet_gadgets[GID_2_LB2], (ULONG *) &code
  851.         )))
  852.         {   rq("Unsupported inquiry!"); // should never happen
  853.         }
  854.         aminet.subtype = code;
  855.     break;
  856.     default:
  857.     break;
  858. }   }
  859.  
  860. AGLOBAL void newaminet(ABOOL display)
  861. {   aminet.amishort[0]     =
  862.     aminet.uploader[0]     =
  863.     aminet.author[0]       =
  864.     aminet.requires[0]     =
  865.     aminet.distribution[0] =
  866.     aminet.type[0]         =
  867.     aminet.replaces[0]     =
  868.     aminet.output[0]       =
  869.     aminet.textfield[0]    =
  870.     aminet.maintype        =
  871.     aminet.subtype         = 0;
  872.     strcpy(aminet.version, "1.0");
  873.  
  874.     if (display)
  875.         updateaminetgadgets();
  876. }
  877.  
  878. AGLOBAL void openaminet(void)
  879. {   if (asl("#?.readme"))
  880.     {   loadaminet();
  881.         updateaminetgadgets();
  882. }   }
  883.  
  884. AGLOBAL void loadaminet(void)
  885. {   ABOOL done = FALSE;
  886.     ULONG i, j, slashpos = 0;
  887.     TEXT  tempstring[13];
  888.  
  889.     if (readin(aslresult))
  890.     {   strcpy(aminet.output, aslresult);
  891.         offset = 0;
  892.  
  893.         // Clear all fields.
  894.         aminet.amishort[0]     =
  895.         aminet.uploader[0]     =
  896.         aminet.author[0]       =
  897.         aminet.requires[0]     =
  898.         aminet.distribution[0] =
  899.         aminet.type[0]         =
  900.         aminet.replaces[0]     =
  901.         aminet.output[0]       =
  902.         aminet.textfield[0]    =
  903.         aminet.maintype        =
  904.         aminet.subtype         =
  905.         aminet.version[0]      = 0;
  906.  
  907.         do
  908.         {   parse("\n");
  909.             if (string[0] == 0 || (string[0] == CR && string[1] == 0)) // CR support is for IBM-PC compatibility
  910.             {   done = TRUE;
  911.                 parsetoend();
  912.                 strcpy(aminet.textfield, string);
  913.             } elif (!strncmp(string, "Short:",         6))
  914.             {   for (i =  6; i < strlen(string); i++)
  915.                 {   if (string[i] != ' ')
  916.                     {   strcpy(aminet.amishort,     &string[i]);
  917.                         break;
  918.             }   }   }
  919.             elif (!strncmp(string, "Uploader:",      9))
  920.             {   for (i =  9; i < strlen(string); i++)
  921.                 {   if (string[i] != ' ')
  922.                     {   strcpy(aminet.uploader,     &string[i]);
  923.                         break;
  924.             }   }   }
  925.             elif (!strncmp(string, "Author:",        7))
  926.             {   for (i =  7; i < strlen(string); i++)
  927.                 {   if (string[i] != ' ')
  928.                     {   strcpy(aminet.author,       &string[i]);
  929.                         break;
  930.             }   }   }
  931.             elif (!strncmp(string, "Type:",          5))
  932.             {   for (i =  5; i < strlen(string); i++)
  933.                 {   if (string[i] != ' ')
  934.                     {   // OK, we are now at the start of useful data
  935.                         strcpy(aminet.type, &string[i]);
  936.                         while (aminet.type[slashpos] != '/')
  937.                         {   slashpos++;
  938.                         }
  939.                         // slashpos is now offset of '/'
  940.                         strncpy(tempstring, aminet.type, slashpos);                        tempstring[slashpos] = 0;
  941.                         for (j = 0; j <= MAINTYPES; j++)
  942.                         {   if (!strcmp(tempstring, category[j].name))
  943.                             {   aminet.maintype = j; // set up aminet.maintype
  944.                                 break;
  945.                         }   }
  946.                         slashpos++; // move past '/'
  947.                         for (j = offsets[aminet.maintype].start; j <= offsets[aminet.maintype].end; j++)
  948.                         {   if (!strcmp(&aminet.type[slashpos], category[j].name))
  949.                             {   aminet.subtype = j - offsets[aminet.maintype].start;
  950.                                 break;
  951.                         }   }
  952.                         break;
  953.             }   }   }
  954.             elif (!strncmp(string, "Replaces:",      9))
  955.             {   for (i =  9; i < strlen(string); i++)
  956.                 {   if (string[i] != ' ')
  957.                     {   strcpy(aminet.replaces,     &string[i]);
  958.                         break;
  959.             }   }   }
  960.             elif (!strncmp(string, "Requires:",      9))
  961.             {   for (i =  9; i < strlen(string); i++)
  962.                 {   if (string[i] != ' ')
  963.                     {   strcpy(aminet.requires,     &string[i]);
  964.                         break;
  965.             }   }   }
  966.             elif (!strncmp(string, "Version:",       8))
  967.             {   for (i =  8; i < strlen(string); i++)
  968.                 {   if (string[i] != ' ')
  969.                     {   strcpy(aminet.version,      &string[i]);
  970.                         break;
  971.             }   }   }
  972.             elif (!strncmp(string, "Distribution:", 13))
  973.             {   for (i = 13; i < strlen(string); i++)
  974.                 {   if (string[i] != ' ')
  975.                     {   strcpy(aminet.distribution, &string[i]);
  976.                         break;
  977.         }   }   }   }
  978.         while (!done);
  979. }   }
  980.  
  981. MODULE void updateaminetgadgets(void)
  982. {   SetGadgetAttrs
  983.     (   aminet_gadgets[GID_2_ST1], MainWindowPtr, NULL,
  984.         GTST_String, aminet.amishort,
  985.         TAG_END
  986.     );
  987.     SetGadgetAttrs
  988.     (   aminet_gadgets[GID_2_ST2], MainWindowPtr, NULL,
  989.         GTST_String, aminet.uploader,
  990.         TAG_END
  991.     );
  992.     SetGadgetAttrs
  993.     (   aminet_gadgets[GID_2_ST3], MainWindowPtr, NULL,
  994.         GTST_String, aminet.author,
  995.         TAG_END
  996.     );
  997.     SetGadgetAttrs
  998.     (   aminet_gadgets[GID_2_ST4], MainWindowPtr, NULL,
  999.         GTST_String, aminet.version,
  1000.         TAG_END
  1001.     );
  1002.     SetGadgetAttrs
  1003.     (   aminet_gadgets[GID_2_ST5], MainWindowPtr, NULL,
  1004.         GTST_String, aminet.replaces,
  1005.         TAG_END
  1006.     );
  1007.     SetGadgetAttrs
  1008.     (   aminet_gadgets[GID_2_ST6], MainWindowPtr, NULL,
  1009.         GTST_String, aminet.requires,
  1010.         TAG_END
  1011.     );
  1012.     SetGadgetAttrs
  1013.     (   aminet_gadgets[GID_2_ST7], MainWindowPtr, NULL,
  1014.         GTST_String, aminet.distribution,
  1015.         TAG_END
  1016.     );
  1017.     SetGadgetAttrs // `Type'
  1018.     (   aminet_gadgets[GID_2_LB1],
  1019.         MainWindowPtr, NULL,
  1020.         LISTBROWSER_Selected, aminet.maintype,
  1021.         TAG_END
  1022.     );
  1023.  
  1024.     updatesubtype();
  1025.  
  1026.     SetGadgetAttrs
  1027.     (   aminet_gadgets[GID_2_TE1], MainWindowPtr, NULL,
  1028.         GA_TEXTEDITOR_Contents, aminet.textfield,
  1029.         TAG_DONE
  1030.     );
  1031.     // It would be polite to scroll the listviews so that the selected
  1032.     // entries are visible.
  1033. }
  1034. MODULE void readaminetgadgets(void)
  1035. {   STRPTR stringptr;
  1036.  
  1037.     if (!(GetAttr
  1038.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST1], (ULONG *) &stringptr
  1039.     )))
  1040.     {   rq("Unsupported inquiry!"); // should never happen
  1041.     }
  1042.     strcpy(aminet.amishort, stringptr);
  1043.  
  1044.     if (!(GetAttr
  1045.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST2], (ULONG *) &stringptr
  1046.     )))
  1047.     {   rq("Unsupported inquiry!"); // should never happen
  1048.     }
  1049.     strcpy(aminet.uploader, stringptr);
  1050.  
  1051.     if (!(GetAttr
  1052.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST3], (ULONG *) &stringptr
  1053.     )))
  1054.     {   rq("Unsupported inquiry!"); // should never happen
  1055.     }
  1056.     strcpy(aminet.author, stringptr);
  1057.  
  1058.     if (!(GetAttr
  1059.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST4], (ULONG *) &stringptr
  1060.     )))
  1061.     {   rq("Unsupported inquiry!"); // should never happen
  1062.     }
  1063.     strcpy(aminet.replaces, stringptr);
  1064.  
  1065.     if (!(GetAttr
  1066.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST5], (ULONG *) &stringptr
  1067.     )))
  1068.     {   rq("Unsupported inquiry!"); // should never happen
  1069.     }
  1070.     strcpy(aminet.requires, stringptr);
  1071.  
  1072.     if (!(GetAttr
  1073.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST6], (ULONG *) &stringptr
  1074.     )))
  1075.     {   rq("Unsupported inquiry!"); // should never happen
  1076.     }
  1077.     strcpy(aminet.version, stringptr);
  1078.  
  1079.     if (!(GetAttr
  1080.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST7], (ULONG *) &stringptr
  1081.     )))
  1082.     {   rq("Unsupported inquiry!"); // should never happen
  1083.     }
  1084.     strcpy(aminet.distribution, stringptr);
  1085.  
  1086.     strcpy(aminet.type, category[aminet.maintype].name);
  1087.     strcat(aminet.type, "/");
  1088.     strcat(aminet.type, category[offsets[aminet.maintype].start + aminet.subtype].name);
  1089.  
  1090.     stringptr = (STRPTR) DoGadgetMethod
  1091.     (   aminet_gadgets[GID_2_TE1], MainWindowPtr, NULL,
  1092.         GM_TEXTEDITOR_ExportText, NULL
  1093.     );
  1094.     strcpy(aminet.textfield, stringptr); // long description
  1095.     FreeVec((APTR) stringptr);
  1096.     // textBuffer = NULL;
  1097. }
  1098.  
  1099. AGLOBAL void aminet_init(void)
  1100. {   ULONG        i, j, length;
  1101.     struct Node* ListBrowserNodePtr;
  1102.  
  1103.     NewList(&SubTypeList);
  1104.     NewList(&EmptySubTypeList);
  1105.  
  1106.     NewList(&MainTypeList);
  1107.     for (i = 0; i <= MAINTYPES; i++)
  1108.     {   strcpy(string, category[i].name);
  1109.         length = 5 - strlen(category[i].name);
  1110.         for (j = 1; j <= length; j++)
  1111.             strcat(string, " ");
  1112.         strcat(string, category[i].desc);
  1113.  
  1114.         if (!(ListBrowserNodePtr = AllocListBrowserNode
  1115.         (    1,              // columns,
  1116.              LBNA_Column,    0,
  1117.              LBNCA_CopyText, TRUE,
  1118.              LBNCA_Text,     string,
  1119.              TAG_END
  1120.         )))
  1121.         {   rq("Can't create ReAction listbrowser.gadget node(s)!");
  1122.         }
  1123.         AddTail(&MainTypeList, ListBrowserNodePtr); // AddTail() has no return code
  1124.         MainTypeNodes = TRUE;
  1125. }   }
  1126.  
  1127. AGLOBAL void aminet_die(void)
  1128. {   if (MainTypeNodes)
  1129.     {   clearreactionlist(&MainTypeList);
  1130.         MainTypeNodes = FALSE;
  1131. }   }
  1132.  
  1133. MODULE void updatesubtype(void)
  1134. {   ULONG        i, j, temp;
  1135.     struct Node* ListBrowserNodePtr;
  1136.      
  1137.     SetGadgetAttrs // `Subtype'
  1138.     (   aminet_gadgets[GID_2_LB2],
  1139.         MainWindowPtr, NULL,
  1140.         LISTBROWSER_Labels, NULL, // detach it
  1141.         TAG_END
  1142.     );
  1143.  
  1144.     if (SubTypeNodes)
  1145.     {   clearreactionlist(&SubTypeList);
  1146.     }
  1147.  
  1148.     SubTypeNodes = TRUE;
  1149.     for
  1150.     (   i = offsets[aminet.maintype].start;
  1151.         i <= offsets[aminet.maintype].end;
  1152.         i++
  1153.     )
  1154.     {   strcpy(string, category[i].name);
  1155.         temp = 6 - strlen(category[i].name);
  1156.         for (j = 1; j <= temp; j++)
  1157.             strcat(string, " ");
  1158.         strcat(string, category[i].desc);
  1159.  
  1160.         if (!(ListBrowserNodePtr = AllocListBrowserNode
  1161.         (    1,                   // columns,
  1162.              LBNCA_CopyText,      TRUE,
  1163.              LBNCA_Text,          string,
  1164.              TAG_END
  1165.         )))
  1166.         {   rq("Can't create ReAction listbrowser.gadget node(s)!");
  1167.         }
  1168.         AddTail(&SubTypeList, ListBrowserNodePtr); // AddTail() has no return code
  1169.     }
  1170.  
  1171.     SetGadgetAttrs // `Subtype'
  1172.     (   aminet_gadgets[GID_2_LB2],
  1173.         MainWindowPtr, NULL,
  1174.         LISTBROWSER_Labels, &SubTypeList,
  1175.         LISTBROWSER_Selected, aminet.subtype,
  1176.         TAG_END
  1177.     );
  1178. }
  1179.  
  1180. AGLOBAL ULONG Hook2Func(struct Hook *h, VOID *o, VOID *msg)
  1181. {   /* "When the hook is called, the data argument points to the 
  1182.     window object and message argument to the IntuiMessage." */
  1183.  
  1184.     UWORD code, qual;
  1185.     ULONG scroll = 0;
  1186.  
  1187.     geta4(); // wait till here before doing anything
  1188.  
  1189.     code = ((struct IntuiMessage *) msg)->Code;
  1190.     qual = ((struct IntuiMessage *) msg)->Qualifier;
  1191.  
  1192.     switch(code)
  1193.     {
  1194.     case SCAN_HELP:
  1195.         helpabout();
  1196.     break;
  1197.     case SCAN_ESCAPE:
  1198.         if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
  1199.         {   cleanexit(EXIT_SUCCESS);
  1200.         } else page = 0;
  1201.     break;
  1202.     case SCAN_UP:
  1203.         if (qual & IEQUALIFIER_CONTROL)
  1204.         {   scroll = LBP_TOP;
  1205.         } elif (qual & IEQUALIFIER_LSHIFT || qual & IEQUALIFIER_RSHIFT)
  1206.         {   scroll = LBP_PAGEUP;
  1207.         } else scroll = LBP_LINEUP;
  1208.     break;
  1209.     case SCAN_DOWN:
  1210.         if (qual & IEQUALIFIER_CONTROL)
  1211.         {   scroll = LBP_BOTTOM;
  1212.         } elif (qual & IEQUALIFIER_LSHIFT || qual & IEQUALIFIER_RSHIFT)
  1213.         {   scroll = LBP_PAGEDOWN;
  1214.         } else scroll = LBP_LINEDOWN;
  1215.     break;
  1216.     case SCAN_S:
  1217.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST1]);
  1218.     break;
  1219.     case SCAN_U:
  1220.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST2]);
  1221.     break;
  1222.     case SCAN_A:
  1223.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST3]);
  1224.     break;
  1225.     case SCAN_R:
  1226.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST4]);
  1227.     break;
  1228.     case SCAN_E:
  1229.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST5]);
  1230.     break;
  1231.     case SCAN_V:
  1232.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST6]);
  1233.     break;
  1234.     case SCAN_D:
  1235.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST7]);
  1236.     break;
  1237.     case SCAN_L:
  1238.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_TE1]);
  1239.     break;
  1240.     default:
  1241.     break;
  1242.     }
  1243.  
  1244.     if (code == SCAN_UP || code == SCAN_DOWN)
  1245.     {   SetGadgetAttrs
  1246.         (   aminet_gadgets[GID_2_LB2],    // pointer to gadget
  1247.             MainWindowPtr,                // pointer to window (not window object!)
  1248.             NULL,                         // pointer to requester
  1249.             LISTBROWSER_Position, scroll, // tags
  1250.             TAG_DONE                      // done
  1251.         );
  1252.     }
  1253.  
  1254.     return(1);
  1255. }
  1256.  
  1257.